package com.controller.library;

import java.io.IOException;
import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bean.library.Student;

public class SLogoutServlet extends HttpServlet{
	/**
	 * 
	 */
	private static final long serialVersionUID = -2238821303899878712L;

	public void service(HttpServletRequest request,HttpServletResponse response){
		try {
			request.setCharacterEncoding("utf-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Student student = (Student)request.getSession().getAttribute("student");
		if(student!=null){
			request.getSession().removeAttribute("student");
		}
		try {
			response.sendRedirect("/Exam1/student/page/index.htm");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
